package com.cjy.map;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
/*
    java.util.LinkedHashMap<k,v> extemds HashMap
 */
public class TestLinkedHashMap {
    public static void main(String[] args) {
        Map<Integer,Integer> hashmap = new HashMap<>();
        hashmap.put(1,5);
        hashmap.put(3,5);
        hashmap.put(4,5);
        hashmap.put(2,5);
        System.out.println(hashmap);
        //linkedHashMap是按照插入顺序输出的
        LinkedHashMap<Integer,Integer> Linked = new LinkedHashMap<>(16,0.75f,true);
        Linked.put(1,5);
        Linked.put(3,5);
        Linked.put(4,5);
        Linked.put(2,5);
        System.out.println(Linked);
    }
}
